#! /usr/bin/env python
# encoding: utf-8

def build(ctx):
    files = ' '
    use = 'default '

    if ctx.env.USING_ELF:
        files += 'SymtabElf.cpp TypeDb.cpp TranscoderPluginDb.cpp Introspection.cpp '
        use += 'elf '

    source = ctx.path.ant_glob(files)
    if len(source) != 0:
        ctx.stlib(target = 'zcm_tools_util',
                  export_includes = "../",
                  use = use,
                  source = source)

        ctx.shlib(name = 'zcm_tools_util_installed',
                  target = 'zcm_tools_util',
                  export_includes = "../",
                  use = use,
                  source = source)

        ctx.install_files('${PREFIX}/include/zcm/tools',
                          ['TranscoderPluginDb.hpp',
                           'TypeDb.hpp',
                           'Introspection.hpp'])
    else:
        ctx(name = 'zcm_tools_util',
            export_includes = '../',
            use  = use)
